Adjust the code to match the documentation, examples, "common sense" and
authorSven Herzberg <sven@imendio.com>
Fri, 8 Feb 2008 00:25:50 +0000 (00:25 +0000)
committerSven Herzberg <herzi@src.gnome.org>
Fri, 8 Feb 2008 00:25:50 +0000 (00:25 +0000)
2008-02-08  Sven Herzberg  <sven@imendio.com>

Adjust the code to match the documentation, examples, "common sense"
and existing applications.

* gtk/gtkaction.c: (_gtk_action_sync_menu_visible): take into account
that a GtkMenu for a <popup> element doesn't have to have a GtkAction
assigned

svn path=/trunk/; revision=19497

ChangeLog
gtk/gtkaction.c

index 085a0c9a300983d5a8493bfc713d0184f7f80c45..28c6a3e4c7ba2171e2e06b2867722b553505b4c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-02-08  Sven Herzberg  <sven@imendio.com>
+
+       Adjust the code to match the documentation, examples, "common sense"
+       and existing applications.
+
+       * gtk/gtkaction.c: (_gtk_action_sync_menu_visible): take into account
+       that a GtkMenu for a <popup> element doesn't have to have a GtkAction
+       assigned
+
 2008-02-07  Cody Russell  <bratsche@gnome.org>
 
        * gdk/win32/gdkevents-win32.c
index ce966e047624a0034a4aaf33f7318813343c02c8..14485a6c03af43d70cbf820af899745f4e7dac6b 100644 (file)
@@ -637,7 +637,8 @@ _gtk_action_sync_menu_visible (GtkAction *action,
                               GtkWidget *proxy,
                               gboolean   empty)
 {
-  gboolean visible, hide_if_empty;
+  gboolean visible = TRUE;
+  gboolean hide_if_empty = TRUE;
 
   g_return_if_fail (GTK_IS_MENU_ITEM (proxy));
   g_return_if_fail (action == NULL || GTK_IS_ACTION (action));
@@ -645,8 +646,12 @@ _gtk_action_sync_menu_visible (GtkAction *action,
   if (action == NULL)
     action = g_object_get_qdata (G_OBJECT (proxy), quark_gtk_action_proxy);
 
-  visible = gtk_action_is_visible (action);
-  hide_if_empty = action->private_data->hide_if_empty;
+  if (action)
+    {
+      /* a GtkMenu for a <popup/> doesn't have to have an action */
+      visible = gtk_action_is_visible (action);
+      hide_if_empty = action->private_data->hide_if_empty;
+    }
 
   if (visible && !(empty && hide_if_empty))
     gtk_widget_show (proxy);